﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
public class BaseThread 
{
    protected CommandBuffer _cmd;
    protected ScriptableRenderContext _context;
    protected string _bufferName;
    public BaseThread(string n)
    {
        _cmd = new CommandBuffer
        {
            name = n
        };
    }
    public void ExecuteCmd()
    {
        if (_context == null)
        {
            return;
        }
        _context.ExecuteCommandBuffer(_cmd);
        _cmd.Clear();
    }

    public void BeginSample()
    {
        _cmd.BeginSample(_bufferName);
        ExecuteCmd();
    }

    public void EndSample()
    {
        _cmd.EndSample(_bufferName);
        ExecuteCmd();
    }

}
